package com.yunxin.core.infra.persistence.mapper.user;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.yunxin.core.application.admin.team.Team;
import com.yunxin.core.infra.persistence.entity.user.UserInfoDO;
import com.yunxin.core.infra.persistence.entity.user.query.condition.UserPageCondition;
import com.yunxin.core.infra.persistence.repository.user.Xto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author zero°
 * @since 2023-06-02
 */
@DS("core")
@Mapper
public interface UserInfoExtendMapper extends UserInfoMapper {

    /**
     * 根据手机号查询用户信息
     * @param phone phone
     * @return UserInfo
     */
    UserInfoDO selectUserInfoByPhone(@Param("phone") String phone);

    /**
     * 根据userCode查询用户信息
     * @param userCode userCode
     * @return UserInfo
     */
    UserInfoDO selectUserInfoByUserCode(@Param("userCode") String userCode);

    /**
     * 分页查询用户列表总条数
     * @param condition condition
     * @return int
     */
    long countUserPageQuery(UserPageCondition condition);

    /**
     * 分页查询用户列表
     * @param condition condition
     * @return List<UserInfo>
     */
    List<UserInfoDO> userPageQuery(UserPageCondition condition);

    /**
     * 根据MD5手机号获取用户数据
     * @param md5Phone md5Phone
     * @return UserInfoDO
     */
    UserInfoDO selectUserInfoByMd5Phone(@Param("md5Phone")String md5Phone);

    List<String> findAllAesPhone();

    void savePhoneNine(@Param("aes") String aes, @Param("phone") String phone);

    /**
     * 根据手机号前9位判断是否存在
     * @param phone
     * @return
     */
    List<String> getMd5PhoneByPhoneNine(@Param("phone") Integer phone);

    List<Xto> xtos();

    void updateX(@Param("xtos") List<Xto> xtos);

    /**
     * 根据订单id查询团队
     * @param ouaaId
     * @return
     */
    List<Team> selectTeamListById(@Param("ouaaId") Long ouaaId);


    /**
     * 根据时间查询用户信息列表
     * @param condition
     * @return
     */
    List<UserInfoDO> selectUserInfoListByTime(UserPageCondition condition);
}
